const Koa = require("koa");
const koaRouter = require("@koa/router");

const app = new Koa();

const userRouter = new koaRouter({ prefix: "/users" });
userRouter.get("/list", (ctx, next) => {
  ctx.body = [
    { name: "why", age: 19, score: 90 },
    { name: "why1", age: 29, score: 99 },
    { name: "why2", age: 39, score: 100 },
  ];
});

app.use(userRouter.routes());

app.listen(9000, () => {
  console.log("9000端口开启");
});
